package com.itcast.stargraph.exception;

import cn.hutool.http.HttpStatus;
import com.itcast.stargraph.dto.common.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 全局异常处理器
 *
 * @Author katana
 * @Date 2025/6/9 11:41
 */
@RestControllerAdvice
public class GlobalExceptionCatch {
    @ExceptionHandler
    public Result<Object> handle(Exception e) {
        e.printStackTrace();
        return Result.error(HttpStatus.HTTP_INTERNAL_ERROR,e.getLocalizedMessage());
    }
}
